package com.ssm.reader.controller.management;

/*
 *
 *
 *@data 2022-05-04
 */

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@Controller
@RequestMapping("/management")
public class ManagementController extends HttpServlet{

    @GetMapping("/index.html")
    public ModelAndView showIndex(){
        ModelAndView modelAndView = new ModelAndView("/management/index");
        return modelAndView;
    }

    @GetMapping("/logout")
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
        request.getSession().invalidate();
        response.sendRedirect("/management/user");
    }
}
